/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SYS_EPOLL_H
#define SYS_EPOLL_H

#include "nstackx_common_header.h"
#include "sys_util.h"

typedef int32_t EpollDesc;
typedef int32_t TaskDesc;

#define INVALID_EPOLL_DESC (-1)
#define INVALID_TASK_DESC (-1)

#define REPRESENT_EPOLL_DESC(epollfd) (epollfd)

static inline bool IsEpollDescValid(EpollDesc epollfd)
{
    return (epollfd >= 0);
}

static inline bool IsEpollDescEqual(EpollDesc epollfd1, EpollDesc epollfd2)
{
    return (epollfd1 == epollfd2);
}

static inline void CloseEpollDesc(EpollDesc epollfd)
{
    CloseDesc(epollfd);
}

#endif // SYS_EPOLL_H
